//
//  ViewController.m
//  CollectionManagerFlow
//
//  Created by Sophia Tsay on 4/18/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "ViewController.h"
#import "ColorUtility.h"

@interface ViewController ()
//@property (strong, nonatomic) IBOutlet UIBarButtonItem *callButton;

@property (strong, nonatomic) IBOutlet UIView *buttonsView;
@property (strong, nonatomic) IBOutlet UIButton *notesButton;
@property (strong, nonatomic) IBOutlet UIButton *detailsButton;
@end

@implementation ViewController
//@synthesize callButton = _callButton;
@synthesize buttonsView = _buttonsView;
@synthesize notesButton = _notesButton;
@synthesize detailsButton = _detailsButton;

- (void) setDetailsButton:(UIButton *)detailsButton
{
    _detailsButton = detailsButton;
    CAGradientLayer *gradientLayer = [ColorUtility buttonGradientLayer];
    
    gradientLayer.frame = _detailsButton.layer.bounds;
    [_detailsButton.layer insertSublayer:gradientLayer atIndex:0];
    _detailsButton.titleLabel.textColor = [UIColor whiteColor];
}

- (void) setNotesButton:(UIButton *)notesButton
{
    _notesButton = notesButton;
    CAGradientLayer *gradientLayer = [ColorUtility buttonGradientLayer];
    
    gradientLayer.frame = _notesButton.layer.bounds;
    [_notesButton.layer insertSublayer:gradientLayer atIndex:0];
    _notesButton.titleLabel.textColor = [UIColor whiteColor];
    
}

- (void) setButtonsView:(UIView *)buttonsView
{
    _buttonsView = buttonsView;
    
    CAGradientLayer *gradientLayer = [ColorUtility toolBarGradientLayer];
    
    gradientLayer.frame = _buttonsView.layer.bounds;
    [_buttonsView.layer insertSublayer:gradientLayer atIndex:0];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)viewDidUnload
{
    [self setButtonsView:nil];
    [self setDetailsButton:nil];
    [self setNotesButton:nil];
    [super viewDidUnload];
    // Release any retained subviews of the main view.
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    /*
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
    } else {
        return YES;
    }
     */
    return YES;
}

@end
